FROM openeuler/openeuler

LABEL maintainer="shenyue24@huawei.com"

# 基础包安装
RUN dnf update -y && \
    dnf install -y --setopt=install_weak_deps=False \
        wget \
        findutils \
        sudo \
        libtool-ltdl \
        container-selinux \
        libseccomp \
        glibc \
        lvm2 \
        docker-client && \
    dnf clean all && \
    rm -rf /var/cache/dnf/* && \
    find /var/log -type f -delete && \
    rm -rf /tmp/* /var/tmp/* && \
    rm -rf /var/lib/dnf/history/*

# 安装Miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py311_25.7.0-2-Linux-x86_64.sh -O miniconda.sh && \
    bash miniconda.sh -b -p /opt/conda && \  
    rm -f miniconda.sh && \ 
    /opt/conda/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
    /opt/conda/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && \
    /opt/conda/bin/conda clean -afy && \
    /opt/conda/bin/conda init bash && \
    echo "conda config --set auto_activate_base true" >> ~/.bashrc && \
    echo "conda config --set notify_outdated_conda false" >> ~/.bashrc
    
ENV PATH="/opt/conda/bin:$PATH"

# 预配置pip镜像源
RUN mkdir -p /root/.pip && \
    printf '[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple/\ntrusted-host = pypi.tuna.tsinghua.edu.cn\ntimeout = 300\nretries = 3\n' > /root/.pip/pip.conf && \
    echo "pip镜像源预配置完成"

# 预安装常用的Python包，避免每次都重复安装
RUN pip install --no-cache-dir \
    numpy \
    pandas \
    scipy \
    matplotlib \
    seaborn \
    scikit-learn \
    uv \
    mcp==1.4.0 \
    && echo "常用Python包预安装完成"

RUN conda --version && \
    python --version && \
    pip --version

# 设置工作目录
WORKDIR /app

CMD ["/bin/bash"]